<div class="main-content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-3 col-md-6 col-xs-12" onclick="alert(123)">
                <div class="info-box bg-primary">
                    <div class="icon-box">
                        <i class="mdi mdi-book-variant"></i>
                    </div>
                    <div class="info-box-content">
                        <h4 class="number"><?php echo $dashboard["num_sub"]; ?></h4>
                        <p class="info-text">公众号</p>
                    </div>
                </div>
            </div>
            <div class="col-lg-3 col-md-6 col-xs-12">
                <div class="info-box bg-success">
                    <div class="icon-box">
                        <i class="mdi mdi-book-open-page-variant"></i>
                    </div>
                    <div class="info-box-content">
                        <h4 class="number"><?php echo $dashboard["num_p"]; ?></h4>
                        <p class="info-text">文章</p>
                    </div>
                </div>
            </div>
            <div class="col-lg-3 col-md-6 col-xs-12">
                <div class="info-box bg-info">
                    <div class="icon-box">
                        <i class="mdi mdi-account"></i>
                    </div>
                    <div class="info-box-content">
                        <h4 class="number"><?php echo $dashboard["num_u"]; ?></h4>
                        <p class="info-text">用户</p>
                    </div>
                </div>
            </div>
            <div class="col-lg-3 col-md-6 col-xs-12">
                <div class="info-box bg-purple">
                    <div class="icon-box">
                        <i class="mdi mdi-console"></i>
                    </div>
                    <div class="info-box-content">
                        <h4 class="number"><?php echo $dashboard["num_task"]; ?></h4>
                        <p class="info-text">任务</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <a href="/<?php echo site_url("dashboard/start"); ?>">开始任务</a>
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <?php if(!$tasks) { ?>
                        <div class="card-header border-bottom">
                            <h4 class="card-title">没有任务等待完成</h4>
                        </div>
                    <?php } else { ?>
                    <div class="card-header border-bottom">
                        <h4 class="card-title">近期任务</h4>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table id="datatable" class="table table-bordered">
                                <thead>
                                <tr>
                                    <td>#</td>
                                    <th>公众号</th>
                                    <th>名称</th>
                                    <th>录入时间</th>
                                    <th>结束时间</th>
                                    <th>文章数</th>
                                    <th>状态</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                $num = count($tasks);
                                for($l=0; $l<$num; $l++){?>
                                    <tr>
                                        <th scope="row"><?php echo $l+1; ?></th>
                                        <td><?php echo $tasks[$l]["sub_id"]; ?></td>
                                        <td><?php echo $tasks[$l]["sub_name"]; ?></td>
                                        <td><?php echo $tasks[$l]["sub_input_time"]; ?></td>
                                        <td><?php echo $tasks[$l]["sub_collect_time"]; ?></td>
                                        <td><?php echo $tasks[$l]["sub_page_num"]; ?></td>
                                        <td>
                                            <?php
                                            switch ($tasks[$l]["sub_status"]){
                                                case 0:
                                                    ?>
                                                    <span class="badge badge-success">完成</span>
                                                    <?php
                                                    break;
                                                case 1:
                                                    ?>
                                                    <span class="badge badge-warning">进行中</span>
                                                    <?php
                                                    break;
                                                case 2:
                                                    ?>
                                                    <span class="badge badge-info">等待</span>
                                                    <?php
                                                    break;
                                                default:
                                                    ?>
                                                    <span class="badge badge-danger">异常</span>
                                                    <?php
                                            }
                                            ?>
                                        </td>
                                    </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <?php } ?>
                </div>
            </div>
        </div>
    </div>
</div>